(() => {
    var K = Object.create;
    var Z = Object.defineProperty;
    var X = Object.getOwnPropertyDescriptor;
    var tt = Object.getOwnPropertyNames;
    var et = Object.getPrototypeOf,
        nt = Object.prototype.hasOwnProperty;
    var at = (a, i) => () => (i || a((i = {
        exports: {}
    }).exports, i), i.exports);
    var it = (a, i, c, m) => {
        if (i && typeof i == "object" || typeof i == "function")
            for (let f of tt(i)) !nt.call(a, f) && f !== c && Z(a, f, {
                get: () => i[f],
                enumerable: !(m = X(i, f)) || m.enumerable
            });
        return a
    };
    var rt = (a, i, c) => (c = a != null ? K(et(a)) : {}, it(i || !a || !a.__esModule ? Z(c, "default", {
        value: a,
        enumerable: !0
    }) : c, a));
    var z = at((j, U) => {
        (function (a, i) {
            typeof j == "object" && typeof U < "u" ? U.exports = i() : typeof define == "function" && define.amd ? define(i) : (a = typeof globalThis < "u" ? globalThis : a || self).dayjs = i()
        })(j, function () {
            "use strict";
            var a = 1e3,
                i = 6e4,
                c = 36e5,
                m = "millisecond",
                f = "second",
                M = "minute",
                v = "hour",
                D = "day",
                S = "week",
                w = "month",
                V = "quarter",
                k = "year",
                _ = "date",
                E = "Invalid Date",
                B = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,
                P = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,
                q = {
                    name: "en",
                    weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
                    months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"),
                    ordinal: function (r) {
                        var n = ["th", "st", "nd", "rd"],
                            t = r % 100;
                        return "[" + r + (n[(t - 20) % 10] || n[t] || n[0]) + "]"
                    }
                },
                N = function (r, n, t) {
                    var s = String(r);
                    return !s || s.length >= n ? r : "" + Array(n + 1 - s.length).join(t) + r
                },
                Q = {
                    s: N,
                    z: function (r) {
                        var n = -r.utcOffset(),
                            t = Math.abs(n),
                            s = Math.floor(t / 60),
                            e = t % 60;
                        return (n <= 0 ? "+" : "-") + N(s, 2, "0") + ":" + N(e, 2, "0")
                    },
                    m: function r(n, t) {
                        if (n.date() < t.date()) return -r(t, n);
                        var s = 12 * (t.year() - n.year()) + (t.month() - n.month()),
                            e = n.clone().add(s, w),
                            u = t - e < 0,
                            o = n.clone().add(s + (u ? -1 : 1), w);
                        return +(-(s + (t - e) / (u ? e - o : o - e)) || 0)
                    },
                    a: function (r) {
                        return r < 0 ? Math.ceil(r) || 0 : Math.floor(r)
                    },
                    p: function (r) {
                        return {
                            M: w,
                            y: k,
                            w: S,
                            d: D,
                            D: _,
                            h: v,
                            m: M,
                            s: f,
                            ms: m,
                            Q: V
                        } [r] || String(r || "").toLowerCase().replace(/s$/, "")
                    },
                    u: function (r) {
                        return r === void 0
                    }
                },
                L = "en",
                T = {};
            T[L] = q;
            var I = function (r) {
                    return r instanceof W
                },
                A = function r(n, t, s) {
                    var e;
                    if (!n) return L;
                    if (typeof n == "string") {
                        var u = n.toLowerCase();
                        T[u] && (e = u), t && (T[u] = t, e = u);
                        var o = n.split("-");
                        if (!e && o.length > 1) return r(o[0])
                    } else {
                        var d = n.name;
                        T[d] = n, e = d
                    }
                    return !s && e && (L = e), e || !s && L
                },
                g = function (r, n) {
                    if (I(r)) return r.clone();
                    var t = typeof n == "object" ? n : {};
                    return t.date = r, t.args = arguments, new W(t)
                },
                h = Q;
            h.l = A, h.i = I, h.w = function (r, n) {
                return g(r, {
                    locale: n.$L,
                    utc: n.$u,
                    x: n.$x,
                    $offset: n.$offset
                })
            };
            var W = function () {
                    function r(t) {
                        this.$L = A(t.locale, null, !0), this.parse(t)
                    }
                    var n = r.prototype;
                    return n.parse = function (t) {
                        this.$d = function (s) {
                            var e = s.date,
                                u = s.utc;
                            if (e === null) return new Date(NaN);
                            if (h.u(e)) return new Date;
                            if (e instanceof Date) return new Date(e);
                            if (typeof e == "string" && !/Z$/i.test(e)) {
                                var o = e.match(B);
                                if (o) {
                                    var d = o[2] - 1 || 0,
                                        $ = (o[7] || "0").substring(0, 3);
                                    return u ? new Date(Date.UTC(o[1], d, o[3] || 1, o[4] || 0, o[5] || 0, o[6] || 0, $)) : new Date(o[1], d, o[3] || 1, o[4] || 0, o[5] || 0, o[6] || 0, $)
                                }
                            }
                            return new Date(e)
                        }(t), this.$x = t.x || {}, this.init()
                    }, n.init = function () {
                        var t = this.$d;
                        this.$y = t.getFullYear(), this.$M = t.getMonth(), this.$D = t.getDate(), this.$W = t.getDay(), this.$H = t.getHours(), this.$m = t.getMinutes(), this.$s = t.getSeconds(), this.$ms = t.getMilliseconds()
                    }, n.$utils = function () {
                        return h
                    }, n.isValid = function () {
                        return this.$d.toString() !== E
                    }, n.isSame = function (t, s) {
                        var e = g(t);
                        return this.startOf(s) <= e && e <= this.endOf(s)
                    }, n.isAfter = function (t, s) {
                        return g(t) < this.startOf(s)
                    }, n.isBefore = function (t, s) {
                        return this.endOf(s) < g(t)
                    }, n.$g = function (t, s, e) {
                        return h.u(t) ? this[s] : this.set(e, t)
                    }, n.unix = function () {
                        return Math.floor(this.valueOf() / 1e3)
                    }, n.valueOf = function () {
                        return this.$d.getTime()
                    }, n.startOf = function (t, s) {
                        var e = this,
                            u = !!h.u(s) || s,
                            o = h.p(t),
                            d = function (x, p) {
                                var b = h.w(e.$u ? Date.UTC(e.$y, p, x) : new Date(e.$y, p, x), e);
                                return u ? b : b.endOf(D)
                            },
                            $ = function (x, p) {
                                return h.w(e.toDate()[x].apply(e.toDate("s"), (u ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(p)), e)
                            },
                            l = this.$W,
                            Y = this.$M,
                            C = this.$D,
                            O = "set" + (this.$u ? "UTC" : "");
                        switch (o) {
                            case k:
                                return u ? d(1, 0) : d(31, 11);
                            case w:
                                return u ? d(1, Y) : d(0, Y + 1);
                            case S:
                                var R = this.$locale().weekStart || 0,
                                    F = (l < R ? l + 7 : l) - R;
                                return d(u ? C - F : C + (6 - F), Y);
                            case D:
                            case _:
                                return $(O + "Hours", 0);
                            case v:
                                return $(O + "Minutes", 1);
                            case M:
                                return $(O + "Seconds", 2);
                            case f:
                                return $(O + "Milliseconds", 3);
                            default:
                                return this.clone()
                        }
                    }, n.endOf = function (t) {
                        return this.startOf(t, !1)
                    }, n.$set = function (t, s) {
                        var e, u = h.p(t),
                            o = "set" + (this.$u ? "UTC" : ""),
                            d = (e = {}, e[D] = o + "Date", e[_] = o + "Date", e[w] = o + "Month", e[k] = o + "FullYear", e[v] = o + "Hours", e[M] = o + "Minutes", e[f] = o + "Seconds", e[m] = o + "Milliseconds", e)[u],
                            $ = u === D ? this.$D + (s - this.$W) : s;
                        if (u === w || u === k) {
                            var l = this.clone().set(_, 1);
                            l.$d[d]($), l.init(), this.$d = l.set(_, Math.min(this.$D, l.daysInMonth())).$d
                        } else d && this.$d[d]($);
                        return this.init(), this
                    }, n.set = function (t, s) {
                        return this.clone().$set(t, s)
                    }, n.get = function (t) {
                        return this[h.p(t)]()
                    }, n.add = function (t, s) {
                        var e, u = this;
                        t = Number(t);
                        var o = h.p(s),
                            d = function (Y) {
                                var C = g(u);
                                return h.w(C.date(C.date() + Math.round(Y * t)), u)
                            };
                        if (o === w) return this.set(w, this.$M + t);
                        if (o === k) return this.set(k, this.$y + t);
                        if (o === D) return d(1);
                        if (o === S) return d(7);
                        var $ = (e = {}, e[M] = i, e[v] = c, e[f] = a, e)[o] || 1,
                            l = this.$d.getTime() + t * $;
                        return h.w(l, this)
                    }, n.subtract = function (t, s) {
                        return this.add(-1 * t, s)
                    }, n.format = function (t) {
                        var s = this,
                            e = this.$locale();
                        if (!this.isValid()) return e.invalidDate || E;
                        var u = t || "YYYY-MM-DDTHH:mm:ssZ",
                            o = h.z(this),
                            d = this.$H,
                            $ = this.$m,
                            l = this.$M,
                            Y = e.weekdays,
                            C = e.months,
                            O = function (p, b, G, H) {
                                return p && (p[b] || p(s, u)) || G[b].slice(0, H)
                            },
                            R = function (p) {
                                return h.s(d % 12 || 12, p, "0")
                            },
                            F = e.meridiem || function (p, b, G) {
                                var H = p < 12 ? "AM" : "PM";
                                return G ? H.toLowerCase() : H
                            },
                            x = {
                                YY: String(this.$y).slice(-2),
                                YYYY: this.$y,
                                M: l + 1,
                                MM: h.s(l + 1, 2, "0"),
                                MMM: O(e.monthsShort, l, C, 3),
                                MMMM: O(C, l),
                                D: this.$D,
                                DD: h.s(this.$D, 2, "0"),
                                d: String(this.$W),
                                dd: O(e.weekdaysMin, this.$W, Y, 2),
                                ddd: O(e.weekdaysShort, this.$W, Y, 3),
                                dddd: Y[this.$W],
                                H: String(d),
                                HH: h.s(d, 2, "0"),
                                h: R(1),
                                hh: R(2),
                                a: F(d, $, !0),
                                A: F(d, $, !1),
                                m: String($),
                                mm: h.s($, 2, "0"),
                                s: String(this.$s),
                                ss: h.s(this.$s, 2, "0"),
                                SSS: h.s(this.$ms, 3, "0"),
                                Z: o
                            };
                        return u.replace(P, function (p, b) {
                            return b || x[p] || o.replace(":", "")
                        })
                    }, n.utcOffset = function () {
                        return 15 * -Math.round(this.$d.getTimezoneOffset() / 15)
                    }, n.diff = function (t, s, e) {
                        var u, o = h.p(s),
                            d = g(t),
                            $ = (d.utcOffset() - this.utcOffset()) * i,
                            l = this - d,
                            Y = h.m(this, d);
                        return Y = (u = {}, u[k] = Y / 12, u[w] = Y, u[V] = Y / 3, u[S] = (l - $) / 6048e5, u[D] = (l - $) / 864e5, u[v] = l / c, u[M] = l / i, u[f] = l / a, u)[o] || l, e ? Y : h.a(Y)
                    }, n.daysInMonth = function () {
                        return this.endOf(w).$D
                    }, n.$locale = function () {
                        return T[this.$L]
                    }, n.locale = function (t, s) {
                        if (!t) return this.$L;
                        var e = this.clone(),
                            u = A(t, s, !0);
                        return u && (e.$L = u), e
                    }, n.clone = function () {
                        return h.w(this.$d, this)
                    }, n.toDate = function () {
                        return new Date(this.valueOf())
                    }, n.toJSON = function () {
                        return this.isValid() ? this.toISOString() : null
                    }, n.toISOString = function () {
                        return this.$d.toISOString()
                    }, n.toString = function () {
                        return this.$d.toUTCString()
                    }, r
                }(),
                J = W.prototype;
            return g.prototype = J, [
                ["$ms", m],
                ["$s", f],
                ["$m", M],
                ["$H", v],
                ["$W", D],
                ["$M", w],
                ["$y", k],
                ["$D", _]
            ].forEach(function (r) {
                J[r[1]] = function (n) {
                    return this.$g(n, r[0], r[1])
                }
            }), g.extend = function (r, n) {
                return r.$i || (r(n, W, g), r.$i = !0), g
            }, g.locale = A, g.isDayjs = I, g.unix = function (r) {
                return g(1e3 * r)
            }, g.en = T[L], g.Ls = T, g.p = {}, g
        })
    });
    var y = rt(z()),
        st = ["\u65E5", "\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D"];
    Component({
        properties: {
            markCalendarList: {
                type: Array,
                value: [],
                observer: function (a, i) {
                    this.handeleMarkCalendarList()
                }
            },
            isToday: {
                type: Boolean,
                value: !1
            },
            defaultDate: {
                type: String,
                value: null
            },
            showFolding: {
                type: Boolean,
                value: !0
            },
            weeekLayer: {
                type: Number,
                value: 1
            }
        },
        lifetimes: {
            attached: function () {},
            detached: function () {},
            created: function () {},
            ready: function () {
                let a = wx.createAnimation({
                    duration: 230,
                    delay: 0
                });
                this.setData({
                    animation: a.export(),
                    MonthRange: this.data.defaultDate ? (0, y.default)(this.data.defaultDate) : (0, y.default)(),
                    value: this.data.defaultDate ? (0, y.default)(this.data.defaultDate).format("YYYY-MM-DD") : (0, y.default)().format("YYYY-MM-DD")
                }, () => {
                    this.generationCalendar()
                })
            }
        },
        data: {
            today: (0, y.default)().format("YYYY-MM-DD"),
            MonthRange: (0, y.default)(),
            MonthText: (0, y.default)().format("YYYY\u5E74MM\u6708"),
            value: (0, y.default)().format("YYYY-MM-DD"),
            calendar: [],
            calendarGroups: [],
            weekdaysShort: st,
            isFold: !1,
            showFolding: !0,
            weeekLayer: 1,
            animation: {}
        },
        observers: {
            MonthRange: function (a) {
                this.setData({
                    MonthText: a.format("YYYY\u5E74MM\u6708")
                })
            },
            value: function (a) {
                this.setData({
                    MonthText: (0, y.default)(a).format("YYYY\u5E74MM\u6708")
                })
            },
            calendarGroups: function (a) {
                if (this.data.isFold && a) {
                    let i = (0, y.default)(a[0].date).month();
                    this.setData({
                        MonthRange: this.data.MonthRange.month(i)
                    })
                }
            }
        },
        methods: {
            generationCalendar() {
                let {
                    MonthRange: a
                } = this.data, i = a.daysInMonth(), c = a.startOf("month").format("d"), m = a.endOf("month").format("d"), f = a.startOf("month"), M = a.endOf("month"), v = [];
                for (let D = 0; D < Number(c); D++) {
                    let S = f.subtract(D + 1, "days").format("YYYY-MM-DD");
                    v.unshift({
                        date: S,
                        isCurrent: 0
                    })
                }
                for (let D = 0; D < i; D++) {
                    let S = a.date(D + 1).format("YYYY-MM-DD");
                    v.push({
                        date: S,
                        isCurrent: 1
                    })
                }
                for (let D = 0; D < 6 - Number(m); D++) {
                    let S = M.add(D + 1, "days").format("YYYY-MM-DD");
                    v.push({
                        date: S,
                        isCurrent: 0
                    })
                }
                this.setData({
                    calendar: v
                }, () => this.generationWeek())
            },
            generationWeek(a) {
                let {
                    value: i,
                    weeekLayer: c
                } = this.data, m = 7 * c, f = [];
                if (a === "next")
                    for (let M = 0; M < m; M++) f.push({
                        date: (0, y.default)(this.data.calendarGroups[0].date).add(c, "week").startOf("week").add(M, "day").format("YYYY-MM-DD"),
                        isCurrent: 1
                    });
                else if (a === "prev")
                    for (let M = 0; M < m; M++) f.push({
                        date: (0, y.default)(this.data.calendarGroups[0].date).subtract(c, "week").startOf("week").add(M, "day").format("YYYY-MM-DD"),
                        isCurrent: 1
                    });
                else
                    for (let M = 0; M < m; M++) f.push({
                        date: i ? (0, y.default)(i).startOf("week").add(M, "day").format("YYYY-MM-DD") : MonthRange.startOf("week").add(M, "day").format("YYYY-MM-DD"),
                        isCurrent: 1
                    });
                this.setData({
                    calendarGroups: f
                }, () => {
                    this.getRangeDate(), this.handeleMarkCalendarList()
                })
            },
            getRangeDate() {
                let {
                    isFold: a,
                    calendar: i,
                    calendarGroups: c
                } = this.data, m = a ? c[0].date : i[0].date, f = a ? c[c.length - 1].date : i[i.length - 1].date;
                this.triggerEvent("onRangeDate", {
                    beginTime: m,
                    endTime: f
                })
            },
            handeleMarkCalendarList() {
                let {
                    calendar: a,
                    calendarGroups: i,
                    markCalendarList: c
                } = this.data;
                this.setData({
                    calendar: a.map(m => ({
                        ...m,
                        pointColor: c.find(f => m.date == f.date)?.pointColor
                    })),
                    calendarGroups: i.map(m => ({
                        ...m,
                        pointColor: c.find(f => m.date == f.date)?.pointColor
                    }))
                })
            },
            onCheck(a) {
                let {
                    item: i
                } = a.target.dataset, {
                    date: c
                } = i;
                this.setData({
                    value: c
                }, () => {
                    this.triggerEvent("onSelect", {
                        day: c
                    })
                })
            },
            onFold() {
                this.setData({
                    isFold: !this.data.isFold
                }, () => {
                    this.generationCalendar()
                })
            },
            onNext() {
                let {
                    MonthRange: a,
                    isFold: i
                } = this.data;
                i || this.setData({
                    MonthRange: a.add(1, i ? "week" : "month")
                }, () => {
                    this.generationCalendar()
                }), this.generationWeek("next"), this.onAnimation()
            },
            onPrev() {
                let {
                    MonthRange: a,
                    isFold: i
                } = this.data;
                i || this.setData({
                    MonthRange: a.subtract(1, i ? "week" : "month")
                }, () => {
                    this.generationCalendar()
                }), this.generationWeek("prev"), this.onAnimation()
            },
            onSlide(a) {
                switch (a.detail) {
                    case "R":
                        this.onPrev();
                        break;
                    case "L":
                        this.onNext();
                        break;
                    default:
                        break
                }
            },
            onAnimation() {
                let a = wx.createAnimation({
                    duration: 320,
                    timingFunction: "step-start",
                    delay: 0
                });
                a.opacity(.3).step(), a.opacity(1).step(), this.setData({
                    animation: a.export()
                })
            },
            onToToday() {
                this.setData({
                    value: (0, y.default)().format("YYYY-MM-DD"),
                    MonthRange: (0, y.default)()
                }, () => {
                    this.generationCalendar(), this.triggerEvent("onSelect", {
                        day: (0, y.default)().format("YYYY-MM-DD")
                    })
                })
            }
        }
    });
})();